function [Xi  xmean3 ymean3 zmean3 scalef3] = normalize3DCoord(Xreal)

xmean3 = mean(Xreal(1,:));
ymean3 = mean(Xreal(2,:));
zmean3 = mean(Xreal(3,:));

Xreal = Xreal - repmat( [xmean3; ymean3; zmean3;0],1,size(Xreal,2));

rms = sqrt( 3*mean(Xreal(1,:).^2 + Xreal(2,:).^2 + Xreal(3,:).^2) );
scalef3 = 1/rms;

Xi = Xreal / rms;
Xreal = Xi;
sqrt( 3*mean(Xreal(1,:).^2 + Xreal(2,:).^2 + Xreal(3,:).^2) )

breakhere = 1;
